package net.plankton.events;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class GenericEventProvider extends EventProvider {

	boolean run = true;
	
	@Override
	public void run() {
		while (run) {
			for (Iterator<GenericOccurrence> it = possibleEvents.iterator();it.hasNext();) {
				GenericOccurrence go = it.next();
				if (go.isRelevant()) {
//					System.err.println(go.describe());
					go.happen();
				}
			}
			try {
				Thread.sleep(EventProvider.SLEEP_PERIOD);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	@Override
	public void end() {
		run = false;
		
	}
	
	
}
